package com.atguigu.gulimall.product.web;

import com.atguigu.gulimall.product.service.AttrGroupService;
import com.atguigu.gulimall.product.service.SkuInfoService;
import com.atguigu.gulimall.product.vo.ItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class ItemController {
    @Autowired
    private SkuInfoService skuInfoService;
    @Autowired
    AttrGroupService attrGroupService;
    @GetMapping("/{skuId}.html")
    public String item(@PathVariable Long skuId, Model model){
        ItemVo itemVo = null;
        try {
            itemVo = skuInfoService.item(skuId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        model.addAttribute("item",itemVo);
        return "item";
    }

}
